package com.hq.ims.data.vo;

import com.hq.authority.utils.AppUtils;
import com.hq.ims.data.config.verification.VdEdit;
import com.hq.ims.data.entity.BusInfoTrack;
import com.hq.ims.data.entityenum.*;
import com.hq.ims.data.vo.auth.BaseRowAuthVo;
import com.hq.utils.util.ListUtils;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import org.mapstruct.Mapper;
import org.mapstruct.Mappings;
import org.mapstruct.factory.Mappers;

import javax.validation.constraints.NotBlank;
import java.math.BigDecimal;
import java.time.LocalDateTime;
import java.util.List;
import java.util.stream.Collectors;


/**
 * @author 蒋柏平
 * @since 20241024
 */
@Mapper
public interface BusInfoTrackMapstruct {

    BusInfoTrackMapstruct INSTANCE = Mappers.getMapper(BusInfoTrackMapstruct.class);

    //-------------------------------- 转换VO类 --------------------------------

    @Mappings({
    })
    BusInfoTrackVo toBusInfoTrackVo(BusInfoTrack source);

    default List<BusInfoTrackVo> toBusInfoTrackVoList(List<BusInfoTrack> source) {
        if (source == null) {
            return ListUtils.newEmptyList();
        }
        return source.stream().map(this::toBusInfoTrackVo).collect(Collectors.toList());
    }

    //-------------------------------- 以下为自定义类[输出对象] --------------------------------

    @ApiModel(value = "原始对象的扩展类")
    @Data
    class BusInfoTrackVo {

        @ApiModelProperty(value = "数据id")
        private String busInfoTrackId;

        @ApiModelProperty(value = "经营信息id")
        private String busiInfoId;

        @ApiModelProperty(value = "项目名称")
        private String projectName;

        @ApiModelProperty(value = "信息类型")
        private EnumBusinessTypeStatus infoType;

        @ApiModelProperty(value = "省份")
        private String province;

        @ApiModelProperty(value = "城市")
        private String city;

        @ApiModelProperty(value = "产业标记id")
        private String industryMarkId;

        @ApiModelProperty(value = "产业标记")
        private String industryMarkName;

        @ApiModelProperty(value = "项目阶段")
        private EnumProjectPhase projectStage;

        @ApiModelProperty(value = "项目地址")
        private String projectAddressName;

        @ApiModelProperty(value = "经度")
        private String longitude;

        @ApiModelProperty(value = "纬度")
        private String latitude;

        @ApiModelProperty(value = "预计产值规模")
        private BigDecimal outputScale;

        @ApiModelProperty(value = "业主方公司名称")
        private String ownerCompanyName;

        @ApiModelProperty(value = "施工方公司名称")
        private String constructionName;

        @ApiModelProperty(value = "项目备注")
        private String projectRemark;

        @ApiModelProperty(value = "推送目标企业")
        private String pushCompany;

        @ApiModelProperty(value = "发布人")
        private String publisher;

        @ApiModelProperty(value = "经营人员名称")
        private String busiPersonName;

        @ApiModelProperty(value = "最新的反馈阶段")
        private EnumFeedbackPhase lastNewFeedbackPhase;

        @ApiModelProperty(value = "最新的反馈时间")
        private LocalDateTime lastNewFeedbackDate;

        @ApiModelProperty(value = "父Id")
        private String parentId;

        @ApiModelProperty(value = "根Id")
        private String rootId;

        @ApiModelProperty(value = "派生信息标签")
        private EnumRootInformation rootInformationTag;

    }

    @ApiModel(value = "详情Vo")
    @Data
    class DetailVo {
        @ApiModelProperty(value = "数据id")
        private String busInfoTrackId;

        @ApiModelProperty(value = "经营信息ID")
        private String busiInfoId;

        @ApiModelProperty(value = "项目名称")
        private String projectName;

        @ApiModelProperty(value = "信息类型")
        private EnumBusinessTypeStatus infoType;

        @ApiModelProperty(value = "省份")
        private String province;

        @ApiModelProperty(value = "城市")
        private String city;

        @ApiModelProperty(value = "产业标记")
        private String industryMarkName;

        @ApiModelProperty(value = "信息来源")
        private String infoSource;

        @ApiModelProperty(value = "项目阶段")
        private EnumProjectPhase projectStage;

        @ApiModelProperty(value = "经度")
        private String longitude;

        @ApiModelProperty(value = "纬度")
        private String latitude;

        @ApiModelProperty(value = "项目位置")
        private String projectAddressName;

        @ApiModelProperty(value = "预计产值规模")
        private BigDecimal outputScale;

        @ApiModelProperty(value = "业主方公司名称")
        private String ownerCompanyName;

        @ApiModelProperty(value = "施工方公司名称")
        private String constructionName;

        @ApiModelProperty(value = "项目备注")
        private String projectRemark;

        @ApiModelProperty(value = "联系人")
        private String contactPerson;

        @ApiModelProperty(value = "联系方式")
        private String contactInfomation;

        @ApiModelProperty(value = "资金来源")
        private String fundingSource;

        @ApiModelProperty(value = "招标获取截止时间")
        private LocalDateTime tenderClosingDate;

        @ApiModelProperty(value = "招标截止时间")
        private LocalDateTime deadlineForBidding;

        @ApiModelProperty(value = "项目规模")
        private String projectScale;

        @ApiModelProperty(value = "工期要求")
        private String durationRequired;

        @ApiModelProperty(value = "招标范围")
        private String tenderScope;

        @ApiModelProperty(value = "资质要求")
        private String qualifications;

        @ApiModelProperty(value = "招标控制价")
        private BigDecimal tenderControlPrice;

        @ApiModelProperty(value = "保证金金额")
        private BigDecimal bond;

        @ApiModelProperty(value = "保证金缴纳截止时间")
        private LocalDateTime bondEndTime;

        @ApiModelProperty(value = "经营人员名称")
        private String busiPersonName;

        @ApiModelProperty(value = "最新的反馈阶段")
        private EnumFeedbackPhase lastNewFeedbackPhase;

        @ApiModelProperty(value = "最新的反馈时间")
        private LocalDateTime lastNewFeedbackDate;

        @ApiModelProperty(value ="反馈预警结束时间")
        private LocalDateTime feedbackForewarningEndDate;

        @ApiModelProperty(value = "派生信息标签")
        private EnumRootInformation rootInformationTag;

        @ApiModelProperty(value = "反馈详情列表")
        private List<BusInfoFeedbackMapstruct.FeedbackDetailVo> feedbackDetailVoList;
    }


    @ApiModel(value = "行级权限对象")
    @Data
    class BusInfoTrackRowAuthVo extends BaseRowAuthVo {

        //自定义其它行级权限


        //构造函数
        public BusInfoTrackRowAuthVo(BusInfoTrack entity) {
            //当前操作用户ID
            String userId = AppUtils.getUserId();
        }

    }


    //-------------------------------- 以下为自定义类[输入对象] --------------------------------
    @ApiModel(value = "搜索VO")
    @Data
    class PageSearchVo {
        @ApiModelProperty(value = "项目名称")
        private String projectName;

        @ApiModelProperty(value = "项目阶段")
        private EnumProjectPhase projectStage;

        @ApiModelProperty(value = "省份")
        private String province;

        @ApiModelProperty(value = "地区")
        private String city;

        @ApiModelProperty(value = "反馈阶段")
        private EnumFeedbackPhase feedbackPhase;

        @ApiModelProperty(value = "反馈时间-开始")
        private LocalDateTime feedbackDateStart;

        @ApiModelProperty(value = "反馈时间-结束")
        private LocalDateTime feedbackDateEnd;

        @ApiModelProperty(value = "派生信息标签")
        private EnumRootInformation rootInformationTag;

        @ApiModelProperty(value = "反馈时间排序")
        private String feedbackDateSort;

        @ApiModelProperty(value = "发布人id")
        private String publisherId;

        @ApiModelProperty(value = "经营人员id")
        private String busiPersonId;

        @ApiModelProperty(value = "公司id")
        private String companyId;
    }

    @ApiModel(value = "变更经营人员VO")
    @Data
    class ChangePersonnelVo {
        @NotBlank(message = "数据ID不能为空")
        @ApiModelProperty(value = "数据ID")
        private String busInfoTrackId;

        @NotBlank(message = "经营人员ID不能为空")
        @ApiModelProperty(value = "经营人员ID")
        private String busiPersonId;

        @NotBlank(message = "经营人员名称不能为空")
        @ApiModelProperty(value = "经营人员名称")
        private String busiPersonName;
    }

    @ApiModel(value = "添加和修改对象")
    @Data
    class SaveVo {
        @NotBlank(message = "数据ID不能为空", groups = {VdEdit.class})
        @ApiModelProperty(value = "数据ID")
        private String busInfoTrackId;
        @ApiModelProperty(value = "经营信息ID")
        private String busiInfoId;
        @ApiModelProperty(value = "产业标记ID")
        private String industryMarkId;
        @ApiModelProperty(value = "产业标记名称")
        private String industryMarkName;
        @ApiModelProperty(value = "推送")
        private String busInfoNotificationId;
        @ApiModelProperty(value = "企业ID")
        private String companyId;
        @ApiModelProperty(value = "企业名称")
        private String companyName;
        @ApiModelProperty(value = "经营人员ID")
        private String busiPersonId;
        @ApiModelProperty(value = "经营人员名称")
        private String busiPersonName;

    }

    //-------------------------------- springboot验证标识 --------------------------------

}
